<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>通知信息列表</title>
    <link rel="stylesheet" type="text/css" href="../css/jquery/jquery-ui-1.8.23.custom.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="../css/jqgrid/ui.jqgrid.css" media="screen"/>
    <jsp:include page="../../../head.jsp"/>
</head>
<script type="text/javascript">
    $(function () {
        var deptId = $("#deptId").val();
        if (deptId == "") {
            deptId = "${deptId}";
        }
        var state_option = [["待发送", "0"], ["已发送", "1"]];
        $("#mrdForm").mrdForm({
            title: "查询列表",// 表单标题
            columns: [{
                name: "types",
                label: "通知类型",
                type: "dropdown",
                dropdownType: "ajax",
                dataType: "json",
                url: "sysval-gridData?pid=B",// 查询地址
                minLength: 0,
                method: "post",// 提交方式
                success: function (data) {
                    var options = "";
                    if (data.systemValues != null)
                        $(data.systemValues).each(function (i, n) {
                            options = options + "['" + n.chn + "','" + n.id + "'],";//+"<option value='"+this.id+"'>"+this.chn+"</option>";
                        });
                    if (options) {
                        options = options.substring(0, options.length - 1);
                    }
                    //return "["+options+"]";
                    return eval("[" + options + "]");
                }  // ajax成功的回调函数，在方法体内需要将返回的数据组装成[[选项1名称，选项1值],[选项2名称，选项2值]....]这样的形式
            }, {
                name: "issend",
                label: "发送状态",
                type: "dropdown",
                data: state_option
            }

            ],
            buttons: {
                'custom': []
            },
            grid: {
                id: "columnGrid",
                url: "inform-informList",
                colNames: ["id", "用户名", "手机号码", "发送状态", "发送时间", "发送内容"],
                colModel: [{
                    name: 'id',
                    index: 'id',
                    hidden: true,
                    align: "center"
                }, {
                    name: 'uname',
                    index: 'uname',
                    label: "用户名",
                    width: 35,
                    align: "center"
                }, {
                    name: 'umobile',
                    index: 'umobile',
                    label: "手机号码",
                    width: 50,
                    align: "center"
                }, {
                    name: 'issend',
                    index: 'issend',
                    label: "发送状态",
                    width: 20,
                    align: "center",
                    //字段值的显示格式转换
                    formatter: function (cellvalue, options, row) {
                        if (cellvalue == "1") {
                            return "已发送";
                        } else if (cellvalue == "0") {
                            return "待发送";
                        }
                    }
                }, {
                    name: 'sendtime',
                    index: 'sendtime',
                    label: "发送时间",
                    width: 50,
                    align: "center"
                }, {
                    name: 'contents',
                    index: 'contents',
                    label: "发送内容",
                    width: 200,
                    align: "center"
                }],
                title: "通知信息列表",
                //sortname:"ctime",
                //rowNum:5,
                jsonReader: {
                    //从哪个json对象中取值
//                    root: "informDtos"
                },
                onSelectRow: function (id) {
                    //parent.document.getElementById("rightFrame").src="../base/company-mainUser?dept.id="+id;
                },
                ondblClickRow: function (id) {
                    //location.href = "company-manageUser?user.id="+id+"&dept.id="+$("#deptId").val();
                }
            }
        });
        $("#mrdForm").mrdForm("resize");
    });
</script>
<body>
<input type="hidden" id="deptId" value="${deptId}"/>
<div id="mrdForm"></div>
</body>
</html>
